package com.itheima.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.entity.Result;
import com.itheima.mapper.SetmealMapper;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SetmealServiceImpl extends ServiceImpl<SetmealMapper, Setmeal>  implements SetmealService {

    @Autowired
    private SetmealMapper setmealMapper;


    //todo 查询套餐
    @Cacheable(value = "setmeal",key = "'setmeals'")
    @Override
    public Result getAllSetmeal() {

        List<Setmeal> setmeals = setmealMapper.selectList(null);

        return new Result(true,"查询成功",setmeals);
    }
}
